	<?php
	include_once('./mvc/modelo/diseno.php');
	include_once('./mvc/modelo/Accesatabla.php');
	$turno = new Accesatabla('turnosasignados');
	$ds = new diseno();
	if($_GET['idturno'] == ''){
		$cont='<center>
			<form method="POST" action="./?url=adturnoasignado">
					<center>
					<table>
					<tr>
						<td>Hora de Entrada: </td>
						<td><input type="text" id="horaentrada" name="horaentrada" placeholder="hh:mm" required></td>
						<td><select id="forment" name="forment">
									<option value="0"></option>
									<option value="1">a.m</option>
									<option value="2">p.m</option>
							</select></td>
						
					</tr>
					<tr>
						<td>Hora de Salida: </td>
						<td><input type="text" id="horasalida" name="horasalida" placeholder="hh:mm" required></td>
						<td><select id="formsal" name="formsal">
									<option value="0"></option>
									<option value="1">a.m</option>
									<option value="2">p.m</option>
							</select></td>
						
					</tr>
					</table>
					<input type="submit" value="Registrar...">
					</center>
				</form>';
	}
	else{
		$turno->buscarprimaria($_GET['idturno']);
		$horaent = $turno->obtener('horaentrada');
		$horasal = $turno->obtener('horasalida');
		$hent = substr($horaent, 0, 4);
		$hsal = substr($horasal, 0, 4);
		$fent = substr($horaent, -3);
		$fsal = substr($horasal, -3);
		switch($fent){
		case 'a.m': $a = 'selected'; break;
		case 'p.m': $p = 'selected'; break;
		}
		switch($fsal){
		case 'a.m': $an = 'selected'; break;
		case 'p.m': $pm = 'selected'; break;
		}
		$cont='<center>
			<form method="POST" action="./?url=adturnoasignado&id='.$_GET['idturno'].'">
					<center>
					<table>
					<tr>
						<td>Hora de Entrada: </td>
						<td><input type="text" id="horaentrada" name="horaentrada" value="'.$hent.'" required></td>
						<td><select id="forment" name="forment">
									<option value="0"></option>
									<option value="1" '.$a.'>a.m</option>
									<option value="2" '.$p.'>p.m</option>
							</select></td>
						
					</tr>
					<tr>
						<td>Hora de Salida: </td>
						<td><input type="text" id="horasalida" name="horasalida" value="'.$hsal.'" required></td>
						<td><select id="formsal" name="formsal">
								<option value="0"></option>
								<option value="1" '.$an.'>a.m</option>
								<option value="2" '.$pm.'>p.m</option>
							</select></td>
						
					</tr>
					</table>
					<input type="submit" value="Registrar...">
					</center>
				</form>';
	}
	//$ds->nav($_SESSION[navegador]);
	$ds->contenido($cont);
	$ds->mostrar();
?>



